list1=[]
list2=[]
sum=0
a=int(input("请输入你的数字："))
for i in range(1,a):
    b=1/2**i
    sum+=b
    c="1/{}".format(2**i)
    list1.append(b)
    list2.append(c)
    txt=print("+".join(list2),"=",sum)
    str_txt=str(txt)
with open("sum.txt","a",encoding="utf-8") as f:
    f.write(str_txt)
    f.close()

        

